package com.ihr360.insurance.model.dto.benefits;

import com.fasterxml.jackson.annotation.JsonFormat;
import org.hibernate.annotations.Cache;
import org.hibernate.annotations.CacheConcurrencyStrategy;

import javax.persistence.Cacheable;
import javax.persistence.Column;
import javax.persistence.Entity;
import java.util.Date;

/** 法定福利政策 */
@Entity
@Cacheable
@Cache(region = "cnb.base", usage = CacheConcurrencyStrategy.NONSTRICT_READ_WRITE)
public class MandatoryBenefitsMode extends CodeBase<Long> {

    private static final long serialVersionUID = -7161165154134691417L;

    public static final class Field {
        public final static String code = "code";
        public final static String name = "name";
    }

    @Column(unique = true, length = 100, nullable = false)
    protected String code;

    @Override
    public String getCode() {
        return code;
    }

    @Override
    public void setCode(String code) {
        this.code = code;
    }

    @JsonFormat(pattern = "yyyy-MM", timezone = "GMT+8")
    @Override
    public Date getEffectiveAt() {
        return super.getEffectiveAt();
    }

    @JsonFormat(pattern = "yyyy-MM", timezone = "GMT+8")
    @Override
    public void setEffectiveAt(Date effectiveAt) {
        super.setEffectiveAt(effectiveAt);
    }

    @JsonFormat(pattern = "yyyy-MM", timezone = "GMT+8")
    @Override
    public Date getInvalidAt() {
        return super.getInvalidAt();
    }

    @JsonFormat(pattern = "yyyy-MM", timezone = "GMT+8")
    @Override
    public void setInvalidAt(Date invalidAt) {
        super.setInvalidAt(invalidAt);
    }
}
